package com.studay.entity;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import org.springframework.core.io.Resource;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;

import java.util.Locale;

public class Main {

    public static void main(String[] args) {
    // 运行方法 调用 java.exe -classpath target目录下的xml 仅支持 classpath
        // 文件名 classPath是什么 路径
//        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");
        // 相对路径是什么呢？ 绝对路径 相对路径
//        FileSystemXmlApplicationContext applicationContext =
//                new FileSystemXmlApplicationContext("D:\\workwx_scrm\\plateform\\spring\\src\\main\\resources\\spring.xml");



//        FileSystemXmlApplicationContext applicationContext =
//                new FileSystemXmlApplicationContext("spring\\src\\main\\resources\\spring.xml");


        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext(Config.class);
//        AnnotationConfigWebApplicationContext
        System.out.println(applicationContext.getBean("student"));

//        BeanDefinition definition = new
//        ( applicationContext).refresh();
        // 可刷新，不可刷新
        /**
         *
         * 1.可否刷新
         * 2.Spring配置的展现形式 3
         *  1） 配置spring xml文件 ClassPathXmlApplicationContext FileSystemXmlApplicationContext
         *  2） 注解配置 AnnotationConfigApplicationContext
         * */

//
//
//        System.out.println(applicationContext.getEnvironment().getActiveProfiles());
//
//        Resource resource = applicationContext.getResource("D:\\workwx_scrm\\plateform\\spring\\src\\main\\java\\com\\studay\\entity\\Student.java");
//        System.out.println(resource);
//
//        System.out.println(applicationContext.getMessage("test", null, Locale.CHINA));
    }
}
